package ch4;

/**
 * Created by 竹韵澜 on 2017/7/16.
 */

//********************************************************************
// GradeReport.java Java Foundations
//
// Demonstrates the use of a switch statement.
//********************************************************************

import java.util.Scanner;

public class GradeReport {
    //-----------------------------------------------------------------
    // Reads a grade from the user and prints comments accordingly.
    //-----------------------------------------------------------------
    public static void main (String[] args) {
        int grade, category;

        Scanner scan = new Scanner (System.in);

        System.out.print ("Enter a numeric grade (0 to 100): ");
        grade = scan.nextInt();

        category = grade / 10;
        System.out.print ("That grade is ");

        switch (category) {
            case 10:
                System.out.println ("a perfect score. Well done.");
                break;
            case 9:
                System.out.println ("well above average. Excellent.");
                break;
            case 8:
                System.out.println ("above average. Nice job.");
                break;
            case 7:
                System.out.println ("average.");
                break;
            case 6:
                System.out.print ("below average. Please see the ");
                System.out.println ("instructor for assistance.");
                break;
            default:
                System.out.println ("not passing.");

        }
    }
}
